package com.zhixin.fans.ks.ui.utils;

import android.content.Context;

import com.tencent.mm.opensdk.modelpay.PayReq;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;

import com.zhixin.fans.ks.api.res.WxPayInfo;

public class PayUtil {

    public static void payWx(Context context, WxPayInfo payInfo) {
        IWXAPI api = WXAPIFactory.createWXAPI(context, "wx753a100c3a415097");
        api.registerApp("wx753a100c3a415097");
        PayReq req = new PayReq();
        req.appId = payInfo.getAppid();//你的微信appid
        req.partnerId = payInfo.getPartnerid();//商户号
        req.prepayId = payInfo.getPrepayid();//预支付交易会话ID
        req.nonceStr = payInfo.getNoncestr();//随机字符串
        req.timeStamp = payInfo.getTimestamp();//时间戳
        req.packageValue = payInfo.getPackageX();
        req.sign = payInfo.getSign();//签名
        api.sendReq(req);
    }
}
